package com.guli.eduCrm.controller;

import com.guli.commonUtils.R;
import com.guli.eduCrm.entity.CrmBanner;
import com.guli.eduCrm.service.impl.CrmBannerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zxc
 * @date 2023/04/11 09:31
 **/
@Api(description = "banner前台显示")
@RestController
@RequestMapping("/eduCrm/crmBanner/front")
@ResponseBody
//@CrossOrigin // 解决跨域问题
public class CrmBannerFrontController {
    @Autowired
    private CrmBannerServiceImpl crmBannerService;

    /**
     * 查询幻灯片中所要显示的所有数据;
     * @return
     */
    @ApiOperation(value = "查询指定数量的热门数据banner数据")
    @GetMapping("QueryBannerInfo/{count}")
    public R queryCountBanner(
            @PathVariable Integer count){
        // 根据一定的排序规则，获取指定数量的前count条记录;
        List<CrmBanner> list = crmBannerService.queryCountBanner(count);
        return R.ok().data("list" , list);
    }
}
